package com.automation.ljf.converter;

import java.util.Date;

import com.automation.ljf.util.CommonUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;


import com.automation.ljf.domain.dataobject.CaseStepReportDO;
import com.automation.ljf.domain.po.CaseStepReportPO;
import com.automation.ljf.domain.vo.CaseStepReportVO;

/**
 * CaseStepCopy实体转换器
 *
 * @author lijiefeng
 * @since 2021/8/27
 */
@Component
public class CaseStepReportConvert {
    
    public CaseStepReportPO caseStepReportDOToPO(CaseStepReportDO caseStepReportDO, String reportId){
        
        if (caseStepReportDO == null){
            return null;
        }
        CaseStepReportPO caseStepReportPO = new CaseStepReportPO();
        caseStepReportPO.setId(CommonUtil.generateOID())
                .setCaseId(caseStepReportDO.getCaseId())
                .setReportId(reportId)
                .setStepId(caseStepReportDO.getStepId())
                .setStepName(caseStepReportDO.getStepName())
                .setStepXpath(caseStepReportDO.getStepXpath())
                .setStepOperation(caseStepReportDO.getStepOperation())
                .setStepAmount(caseStepReportDO.getStepAmount())
                .setStepParameter(caseStepReportDO.getStepParameter())
                .setStepRelation(caseStepReportDO.getStepRelation())
                .setStepJsonpath(caseStepReportDO.getStepJsonpath())
                .setStepWindow(caseStepReportDO.getStepWindow())
                .setExpectResult(caseStepReportDO.getExpectResult())
                .setActualResult(caseStepReportDO.getActualResult())
                .setStepResDetail(caseStepReportDO.getStepResDetail())
                .setIsInput(caseStepReportDO.getIsInput())
                .setCreateTime(new Date())
                .setUpdateTime(new Date());
        return caseStepReportPO;
    }

    public CaseStepReportVO caseStepReportPOToVO(CaseStepReportPO caseStepReportPO){
        if (caseStepReportPO == null){
            return null;
        }
        CaseStepReportVO caseStepReportVO = new CaseStepReportVO();
        BeanUtils.copyProperties(caseStepReportPO, caseStepReportVO);
        return caseStepReportVO;
    }
    
}
